package com.heishitech.face.controller;

import com.heishitech.face.entity.User;
import com.heishitech.face.service.UserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author Sheeper
 * @date 2017/10/20.
 */
@RestController
@RequestMapping("user")
public class UserController {
    @Resource
    UserService userService;

    @RequestMapping(value = "/insert", method = RequestMethod.GET)
    public String insertUser() {
        User user = new User();
        user.setId(0);
        user.setAddress("address");
        user.setBirthday(new Date());
        user.setName("huaChou");

        if (userService.insert(user) > 0) {
            return "插入成功";
        } else {
            return "插入失败";
        }
    }

}
